from Wzx.wzx9_23.A3mall_po.Base import Base
from selenium.webdriver.common.by import By
from time import sleep


class Page(Base):
    #点击登录
    login_loc=(By.XPATH,'//a[@href="/home/login.html"]')
    def login(self):
        self.click(self.login_loc)
    #断言会员登录
    dy1_text = (By.CLASS_NAME,'reg-new')
    def dy1(self):
        return self.text(self.dy1_text)
    #输入用户名
    username_loc = (By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'13811033962')
    #输入密码
    password_loc = (By.NAME, 'password')
    def password(self):
        self.send_keys(self.password_loc, '123456')
    #输入验证码
    #点击登录按钮
    lohinaniu_loc = (By.CLASS_NAME,'finish-btn')
    def lohinaniu(self):
        self.click(self.lohinaniu_loc)
    #断言欢迎回来
    dy2_loc = (By.XPATH, '/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def dy2(self):
        return self.text(self.dy2_loc)


    def login_A3mall(self):
        self.open_url('http://10.59.9.14:7003/')
        self.login()
        print(self.dy1())
        self.username()
        self.password()
        sleep(10)
        self.lohinaniu()
        sleep(6)
        print(self.dy2())
